package sdc.com.petscalendar.objects;

import java.util.ArrayList;
import java.util.Date;

public class Pet {
	public static final int SEX_MALE = 0;
	public static final int SEX_FEMALE = 1;
	public static final int DOG = 0;
	public static final int CAT = 1;

	private int id;
	private String name, avatar, race;
	private long birthday;
	private int sex;
	private ArrayList<Habbit> habbits;
	private ArrayList<Environment> environments;
	private ArrayList<Treament> treatments;
	private int type;
	private double weight;

	public Pet() {
		id = 0;
		sex = 0;
		birthday = new Date().getTime();
		name = "";
		avatar = "";
		race = "";
		weight = 0;
		habbits = new ArrayList<Habbit>();
		environments = new ArrayList<Environment>();
		treatments = new ArrayList<Treament>();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getRace() {
		return race;
	}

	public void setRace(String race) {
		this.race = race;
	}

	public long getBirthday() {
		return birthday;
	}

	public void setBirthday(long birthday) {
		this.birthday = birthday;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		if (sex < 0 || sex > 1) {
			this.sex = 0;
		} else {
			this.sex = sex;
		}
	}

	public ArrayList<Habbit> getHabbits() {
		return habbits;
	}

	public void setHabbits(ArrayList<Habbit> habbits) {
		this.habbits = habbits;
	}

	public ArrayList<Environment> getEnvironments() {
		return environments;
	}

	public void setEnvironments(ArrayList<Environment> environments) {
		this.environments = environments;
	}

	public ArrayList<Treament> getTreatments() {
		return treatments;
	}

	public void setTreatments(ArrayList<Treament> treatments) {
		this.treatments = treatments;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		if (type < 0 || type > 1) {
			this.type = 0;
		} else {
			this.type = type;
		}
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	@SuppressWarnings("unchecked")
	public Pet clone() {
		Pet pet = new Pet();
		pet.setId(id);
		pet.setAvatar(avatar);
		pet.setBirthday(birthday);

		pet.setName(name);
		pet.setRace(race);
		pet.setSex(sex);

		pet.setType(type);
		pet.setWeight(weight);

		pet.setEnvironments((ArrayList<Environment>) environments.clone());
		pet.setTreatments((ArrayList<Treament>) treatments.clone());
		pet.setHabbits((ArrayList<Habbit>) habbits.clone());
		return pet;
	}
}
